﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FishTank
{
    class Osmolator
    {
        int jumperMode = 1;
        bool Wait10Mins = false;

        //Checks what image should be displayed
        public int check(OperatingSensor operatingSensor, SafetySensor safteySensor, Pump pump, ref double waterLevel, double safetySensorHeight, double operatingSensorHeight, ref double reservoirWaterLevel)
        {

            if (safteySensor.hasBeenTriggered(waterLevel, safetySensorHeight)) //Water level is higher than safety sensor...
            {
                if (jumperMode == 1 || jumperMode == 2)
                {
                    Console.Beep();
                    System.Media.SystemSounds.Exclamation.Play();
                }

                return 1;
            }
            else
            {
                if (operatingSensor.isWaterTooLow(waterLevel, operatingSensorHeight))
                {
                    if (jumperMode == 2 && Wait10Mins == true)
                    {
                        System.Media.SystemSounds.Beep.Play();
                        Console.Beep();
                    }
                    else
                        pump.turnPumpOn(ref waterLevel, ref reservoirWaterLevel);
                    return 2;
                }
            }
            return 0;
        }

        public void setJumperMode(int modeNumber)
        {
            jumperMode = modeNumber;
        }

        public void toogleWaitTenMins()
        {
            Wait10Mins = !Wait10Mins;
        }
    }
}
